// pages/my/xitonglog/index.js
var app = getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        list:[],
        pagenum:1
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var that = this;

    },
    getDataList:function(e){
        var that = this;
        wx.request({
            url:app.data.server + '/index.php/Tongcheng/Book/getFanKui',
            data:{
                uid:getApp().globalData.userInfo.uid
            },
            success:function(d){
                that.setData({
                    list:d.data
                })
            }
        });
    },
    editor:function(e){
      wx.navigateTo({
        url: '/pages/my/kefu/index'
      })
    },
    delLog:function(e){
        var that = this;
        var id = e.currentTarget.dataset.id;
        wx.showModal({
            title:'提示',
            content:'确定要删除吗？',
            showCancel:true,
            success:function(res){
                if (res.confirm) {
                    wx.request({
                        url:getApp().data.server+'/index.php/Tongcheng/Book/delXiTongLog?id='+id,
                        success:res=>{
                        if(0 == res.data){
                        wx.showToast({
                            title:'确认失败',
                            icon: 'success',
                            duration: 2000
                        })
                    }else{
                        wx.showToast({
                            title:'确认成功',
                            icon: 'success',
                            duration: 2000
                        })
                    }
                    setTimeout(function(){
                        that.setData({
                            list:[],
                            pagenum:1
                        })
                        that.getDataList();
                    },1000)

                }
                });
                }
            }
        })
    },
    info:function(e){
        var that = this,id = e.currentTarget.dataset.id;
        wx.navigateTo({
            url: '/pages/my/kefu/index?id='+id
        })
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        var that = this;
        this.setData({
            list:[],
            pagenum:1
        })
        that.getDataList();
    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})